package cn.crawler.app.crown.modules.models;

import cn.crawler.framework.base.model.BaseModel;
import lombok.Data;
import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * 皇冠 赛程 足球
 */
@Data
@Table("crown_match")
public class CrownMatch extends BaseModel implements Serializable {


    /**
     * 主键ID
     */
    @Column
    @Name
    @Comment("ID")
    @ColDefine(type = ColType.VARCHAR, width = 32)
    @PrevInsert(els = {@EL("uuid()")})
    private String id;


    /**
     * 赛事ID
     */
    @Column
    @Comment("赛事ID")
    @ColDefine(type = ColType.VARCHAR, width = 16)
    private String mid;


    /**
     * 阶段 早盘:future、今日:today、 已结束：finished、其他：other(包含赛事取消、球员弃权、赛事延赛、队名错误等等情况)
     */
    @Column
    @Comment("stage")
    @ColDefine(type = ColType.VARCHAR, width = 32)
    private String stage;

    /**
     * 联赛名称
     */
    @Column
    @Comment("联赛名称")
    @ColDefine(type = ColType.VARCHAR, width = 128)
    private String league;

    /**
     * 比赛日期
     */
    @Column
    @Comment("日期")
    @ColDefine(type = ColType.DATETIME, width = 32)
    private Date dateTime;

    public long getDateTimestamp() {
        return null == dateTime ? 0 : dateTime.getTime();
    }

    /**
     * 比赛时间
     */
    @Column
    @Comment("比赛时间")
    @ColDefine(type = ColType.VARCHAR, width = 128)
    private String start;

    /**
     * 主队名称
     */
    @Column
    @Comment("主队名称")
    @ColDefine(type = ColType.VARCHAR, width = 64)
    private String home;

    /**
     * 客队名称
     */
    @Column
    @Comment("客队名称")
    @ColDefine(type = ColType.VARCHAR, width = 64)
    private String custom;

    /**
     * 是否有主场 false true
     */
    @Column
    @Comment("是否有主场")
    @ColDefine(type = ColType.BOOLEAN)
    private Boolean haveHomeCourt;

    /**
     * 是否有滚球 false true
     */
    @Column
    @Comment("是否有滚球")
    @ColDefine(type = ColType.BOOLEAN)
    private Boolean haveRoll;

    /**
     * 上半场主队得分
     */
    @Column
    @Comment("上半场主队得分")
    @ColDefine(type = ColType.VARCHAR, width = 20)
    private String hInBallHalf;

    /**
     * 全场主队得分
     */
    @Column
    @Comment("全场主队得分")
    @ColDefine(type = ColType.VARCHAR, width = 20)
    private String hInBallFull;

    /**
     * 上半场客队得分
     */
    @Column
    @Comment("上半场客队得分")
    @ColDefine(type = ColType.VARCHAR, width = 20)
    private String cInBallHalf;

    /**
     * 全场客队得分
     */
    @Column
    @Comment("全场客队得分")
    @ColDefine(type = ColType.VARCHAR, width = 20)
    private String cInBallFull;


    /**
     * 是否腰斩
     */
    private Boolean isCut = false;

    /**
     * 关联的玩法
     */
    private List bets;

    /**
     * 关联订单成交总额
     */
    private BigDecimal totalAmount = BigDecimal.ZERO;
}
